package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TbPhishingMapper;
import com.ruoyi.system.domain.TbPhishing;
import com.ruoyi.system.service.ITbPhishingService;

/**
 * 钓鱼网站/假冒APP数据填报Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-02-17
 */
@Service
public class TbPhishingServiceImpl implements ITbPhishingService 
{
    @Qualifier("redisTemplate")
    @Autowired
    private RedisTemplate redisTemplate;

    /**
     * 字符串ID生成器
     */
    public String newId(){
        redisTemplate.opsForValue().increment("phishingId");
        return "PH"+redisTemplate.opsForValue().get("phishingId");
    }

    @Autowired
    private TbPhishingMapper tbPhishingMapper;

    /**
     * 查询钓鱼网站/假冒APP数据填报
     * 
     * @param phishingId 钓鱼网站/假冒APP数据填报主键
     * @return 钓鱼网站/假冒APP数据填报
     */
    @Override
    public TbPhishing selectTbPhishingByPhishingId(String phishingId)
    {
        return tbPhishingMapper.selectTbPhishingByPhishingId(phishingId);
    }

    /**
     * 查询钓鱼网站/假冒APP数据填报列表
     * 
     * @param tbPhishing 钓鱼网站/假冒APP数据填报
     * @return 钓鱼网站/假冒APP数据填报
     */
    @Override
    public List<TbPhishing> selectTbPhishingList(TbPhishing tbPhishing)
    {
        return tbPhishingMapper.selectTbPhishingList(tbPhishing);
    }

    /**
     * 新增钓鱼网站/假冒APP数据填报
     * 
     * @param tbPhishing 钓鱼网站/假冒APP数据填报
     * @return 结果
     */
    @Override
    public int insertTbPhishing(TbPhishing tbPhishing)
    {
        tbPhishing.setCreateTime(DateUtils.getNowDate());
        tbPhishing.setPhishingId(newId());
        return tbPhishingMapper.insertTbPhishing(tbPhishing);
    }

    /**
     * 修改钓鱼网站/假冒APP数据填报
     * 
     * @param tbPhishing 钓鱼网站/假冒APP数据填报
     * @return 结果
     */
    @Override
    public int updateTbPhishing(TbPhishing tbPhishing)
    {
        return tbPhishingMapper.updateTbPhishing(tbPhishing);
    }

    /**
     * 批量删除钓鱼网站/假冒APP数据填报
     * 
     * @param phishingIds 需要删除的钓鱼网站/假冒APP数据填报主键
     * @return 结果
     */
    @Override
    public int deleteTbPhishingByPhishingIds(String[] phishingIds)
    {
        return tbPhishingMapper.deleteTbPhishingByPhishingIds(phishingIds);
    }

    /**
     * 删除钓鱼网站/假冒APP数据填报信息
     * 
     * @param phishingId 钓鱼网站/假冒APP数据填报主键
     * @return 结果
     */
    @Override
    public int deleteTbPhishingByPhishingId(String phishingId)
    {
        return tbPhishingMapper.deleteTbPhishingByPhishingId(phishingId);
    }
}
